﻿Public Class ProgramDataGridStyleSelector
    Inherits StyleSelector

    Public Overrides Function SelectStyle(ByVal item As Object, ByVal container As System.Windows.DependencyObject) As System.Windows.Style

        If Not TypeOf item Is LiveProgram Then
            Return MyBase.SelectStyle(item, container)
        End If

        Dim program = DirectCast(item, LiveProgram)
        Dim f = DirectCast(container, FrameworkElement)


        If program.IsAlerted Then
            Return DirectCast(f.FindResource("AlertedProgramRowStyle"), Style)
        ElseIf program.Station.Type = StationType.Channel Then
            Return DirectCast(f.FindResource("ChannelProgramRowStyle"), Style)
        Else
            Return DirectCast(f.FindResource("ProgramRowStyle"), Style)
        End If

    End Function
End Class
